#include "renderBoots.h"
#define SCALE 4


renderBoots::renderBoots(float init_red, float init_green, float init_blue)
{
	//Initiate passed in variables
	r = init_red; g = init_green; b = init_blue;
}

renderBoots::~renderBoots(void)
{
}

// This draw method is intended to draw the shapes, set the material
// and appropriately texture the shapes generated.
void renderBoots::draw(float init_x, float init_y, float init_z, Direction dir)
{


	//THIS is used in basically all of the render functions to position the bottom corner we begin drawing from.
	x = ((init_x) * SCALE) + (SCALE * (3.0/11.0));
	y = ((init_y) * SCALE) + (SCALE * (4.0/11.0));
	z = ((init_z) * SCALE) + ( .2 * SCALE );
	int tait_width = SCALE * (4.0/10.0);
	int tait_depth = SCALE * (2.0/10.0);

	//	/* Set up material properties. */
	GLfloat mat_ambient[] = { 0.2, 0.2, 0.2, 1 };
	GLfloat mat_diffuse[] = { 0.2, 0.2, 0.2, 1 };
	GLfloat mat_specular[] = { 0.8, 0.8, 0.8, 1 };

	glPushMatrix();

	glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
	glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
	glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
	glMaterialf(GL_FRONT, GL_SHININESS, 10.0 ); /* No effect if specular == 0 */

	glTranslatef(x, y, z);

	// DIR is an extra parameter used to find the rotation
	// to be used in the rendering of the stairs
	// the directions refer to North, South, East and West
	int newDir = 0;

	glTranslatef(tait_width, tait_depth, 0);
	switch (dir){
			case UP:
				newDir = 0;
				glRotatef(newDir * 90, 0, 0, 1);
				break;
			case LEFT:
				newDir = 1;
				glRotatef(newDir * 90, 0, 0, 1);
				break;
			case DOWN:
				newDir = 2;
				glRotatef(newDir * 90, 0, 0, 1);
				break;
			case RIGHT:
				newDir = 3;
				glRotatef(newDir * 90, 0, 0, 1);
				break;
	}
	glTranslatef(-tait_width, -tait_depth, 0);

	// Draw Tait
	glColor3f(r, g, b);

	// LEFT SIDE
	LeftShoe();
	RightShoe();

	glTranslatef(-x, -y, -z);

	glPopMatrix();

}

void renderBoots::LeftShoe()
{
	// LEFT SHOE

	glBegin(GL_QUADS);

	glNormal3f(1.0, 0, 0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));

	glNormal3f(-1.0, 0, 0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));

	glNormal3f(1, 0, 0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));

	glNormal3f(0, -1, 0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));

	glNormal3f(0.0, 0.0, 1.0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));

	glNormal3f(0.0, 0.0, -1.0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (0.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (1.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));

	glEnd();

}

void renderBoots::RightShoe()
{

	glBegin(GL_QUADS);

	glNormal3f(1.0, 0, 0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));

	glNormal3f(-1.0, 0, 0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));

	glNormal3f(1, 0, 0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));

	glNormal3f(0, -1, 0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));

	glNormal3f(0.0, 0.0, 1.0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (0.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (0.0/10.0)));

	glNormal3f(0.0, 0.0, -1.0);
	glTexCoord2f(0.0, 0.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(0.0, 1.0); glVertex3f((SCALE * (3.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 1.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (2.0/10.0)), (SCALE * (1.0/10.0)));
	glTexCoord2f(1.0, 0.0); glVertex3f((SCALE * (4.0/10.0)), (SCALE * (0.0/10.0)), (SCALE * (1.0/10.0)));

	glEnd();

}